{{!div class="modal-body"}}
{{#instance}}
<form action="javascript://">
  <div class="row-fluid">
    <div class="span6">
      <label>
        Title
        <span class="required">*</i>
        <i class="grcicon-help-black" rel="tooltip" title="Enter Title"></i>
      </label>
      <input class="input-block-level" placeholder="Enter Title" name="title" type="text" value="{{this.title}}">
    </div>
    <div class="span3">
      <label>
        Company Control?
        <i class="grcicon-help-black" rel="tooltip" title="Is it company control?"></i>
      </label>
      {{!FIXME: Proposed. If it won't be implemented, remove this one}}
      <select name="company_control" class="input-block-level">
        <option selected="selected" value="0">No</option>
        <option value="1">Yes</option>
      </select>
    </div>
    <div class="span3">
      <label>
        Directive
        <span class="required">*</i>
        <i class="grcicon-help-black" rel="tooltip" title="Select Directive"></i>
      </label>
      {{!FIXME: Need List of possible directives // We need titles followed by CODE, not just CODE}}
      <select class="input-block-level" name="directive.id">
        {{#all 'Directive'}}
        <option value="{{id}}">{{title}} ({{slug}})</option>
        {{/all}}
      </select>
    </div>
  </div>
  <div class="row-fluid">
    <div class="span6">
      <label>
        Description
        <span class="required">*</span>
        <i class="grcicon-help-black" rel="tooltip" title="Enter Description"></i>
      </label>
      <div class="wysiwyg-area">
        <textarea id="control_description" class="span12 double wysihtml5" name="description" placeholder="Enter Description">{{{description}}}</textarea>
      </div>
    </div>
    <div class="span6">
      <label>
        Owner/Person of Contact
        <i class="grcicon-help-black" rel="tooltip" title="Enter Owner/Person of Contact"></i>
      </label>
      <input class="input-block-level" name="owner" placeholder="Enter email address" type="text" value="{{owner}}">
      <label>
        Control URL
        <i class="grcicon-help-black" rel="tooltip" title="Enter Control URL"></i>
      </label>
      <input class="input-block-level" name="url" placeholder="http://www.domain.com/" type="text" value="{{url}}">
    </div>
  </div>

  <div class="row-fluid">
    <div class="span12">
      <div class="expand-link">
        <a class="show-hidden-fields" href="javascript://">
          <span class="out">
            <i class="grcicon-show"></i>
            Show 
          </span>
          <span class="in">
            <i class="grcicon-hide"></i>
            Hide
          </span>
          Advanced
          <span class="hidden-fields out">
            Code, Reference URL, Kind, Fraud-Related, Significance, Means, Assertions, Categories
          </span>
        </a>
      </div>
    </div>
  </div>
  <div class="hidden-fields-area" style="display:none">
    <div class="row-fluid">
      <div class="span6">
        <label>
          Code
          <i class="grcicon-help-black" rel="tooltip" title="Enter Code"></i>
        </label>
        <input class="input-block-level" name="slug" placeholder="CONTROL-XXX" type="text" value="{{slug}}">
      </div>
      <div class="span6">
        <label>
          Reference URL
          <i class="grcicon-help-black" rel="tooltip" title="Enter Reference URL"></i>
        </label>
        <input class="input-block-level" name="url" placeholder="http://www.domain.com/" type="text" value="{{url}}">
      </div>
    </div>
    <div class="row-fluid">
      <div class="span3">
        <label>
          Kind
          <i class="grcicon-help-black" rel="tooltip" title="Choose Control Kind"></i>
        </label>
        <select class="input-block-level" name="kind.id" numeric="numeric">
          <option {{^kind.id}}selected="selected"{{/kind.id}} value="">None</option>
          <option value="1" {{^if_equals kind.id '1'}}selected="selected"{{/if_equals}}>Reactive</option>
          <option value="2" {{^if_equals kind.id '2'}}selected="selected"{{/if_equals}}>Administrative</option>
          <option value="3" {{^if_equals kind.id '3'}}selected="selected"{{/if_equals}}>Detective</option>
          <option value="4" {{^if_equals kind.id '4'}}selected="selected"{{/if_equals}}>Preventative</option>
        </select>
      </div>
      <div class="span3">
        <label>
          Fraud Related
          <i class="grcicon-help-black" rel="tooltip" title="Is control fraud related?"></i>
        </label>
        <select class="input-block-level" name="fraud_related">
          <option selected="selected" value="">Choose</option>
          <option value="0" {{^fraud_related}}selected="selected"{{/fraud_related}}>No</option>
          <option value="1" {{#if_equals fraud_related '1'}}selected="selected"{{/if_equals}}>Yes</option>
        </select>
      </div>
      <div class="span3">
        <label>
          Significance
          <i class="grcicon-help-black" rel="tooltip" title="Choose Significance"></i>
        </label>
        <select class="input-block-level" name="key_control">
          <option selected="selected" value="">Choose</option>
          <option value="0" {{^key_control}}selected="selected"{{/key_control}}>Non-key</option>
          <option value="1" {{#if_equals key_control '1'}}selected="selected"{{/if_equals}}>Key</option>
        </select>
      </div>
      <div class="span3">
        <label>
          Means
          <i class="grcicon-help-black" rel="tooltip" title="Define Control Means"></i>
        </label>
        <select class="span12" name="means.id" numeric="numeric">
          <option value="" {{^means.id}}selected="selected"{{/means.id}}>None</option>
          <option value="5" {{^if_equals means.id '5'}}selected="selected"{{/if_equals}}>Manual</option>
          <option value="7" {{^if_equals means.id '7'}}selected="selected"{{/if_equals}}>Automated</option>
          <option value="6" {{^if_equals means.id '6'}}selected="selected"{{/if_equals}}>Manual with Segregation of Duties</option>
        </select>
      </div>
    </div>
    <div class="row-fluid">
      <div class="span6">
        <label>
          Assertions
          <i class="grcicon-help-black" rel="tooltip" title="Choose Control Assertions"></i>
        </label>
        {{!FIXME: Couldn't find variable name for this one w/ POSTMAN}}
        <select class="input-block-level" multiple="multiple" name="assertions">
          <option value="17">Accuracy</option>
          <option value="18">Classification</option>
          <option value="19">Completeness</option>
          <option value="20">Cutoff</option>
          <option value="21">Existence</option>
          <option value="22">Occurrence</option>
          <option value="23">Rights and Obligations</option>
          <option value="24">Valuation and Allocation</option>
          <option value="25">Understandability</option>
        </select>
      </div>
      <div class="span6">
        <label>
          Categories
          <i class="grcicon-help-black" rel="tooltip" title="Choose Control Categories"></i>
        </label>
        {{!FIXME: Couldn't find variable name for this one w/ POSTMAN}}
        <select class="input-block-level" multiple="multiple" name="categories.id">
          {{#all 'Category'}}
          <option value="{{id}}">{{name}}</option>
          {{/all}}
        </select>
      </div>
    </div>
    <div class="row-fluid">
      <div class="span12">
        <label>
          Notes
          <i class="grcicon-help-black" rel="tooltip" title="Enter Additional Notes"></i>
        </label>
        <div class="wysiwyg-area">
          <textarea id="control_notes" class="span12 double wysihtml5" name="notes" placeholder="Enter Notes">{{{notes}}}</textarea>
        </div>
      </div>
    </div>
  </div>
</form>
{{/instance}}
{{!/div}}
